  <?PHP  
   include ("Connections/cpsms.php");
   if (!empty($_POST['username']) and !empty($_POST['password'])) {
	 $username = $_POST['username'];
	 $password = $_POST['password'];
   }else{
      echo "<script language='javascript'> location='faillogin.html'</script>";
   }
    $queryadmin = "select * from cp3003.admin where ADMIN_NAME='$username' and PASSWORD='$password';";
	$sqlsqladmin = mysql_query($queryadmin) or die(mysql_error());
	$countadmin = mysql_num_rows($sqlsqladmin);
	if($countadmin == 1){
    echo "<script language='javascript'>location='aditems.php'</script>";
    }
	
  $sql = mysql_query("select * from cp3003.users where USER_LOGIN_NAME ='$username' and USER_PASSWORD='$password';")
                      or die(mysql_error());
  $count = mysql_num_rows($sql);
	  
if($count == 1){
mysql_query("DELETE from cp3003.login;");
mysql_query("INSERT INTO cp3003.login (LOGIN_USER_NAME) VALUES ('$username');");
      echo "<script language='javascript'> location='displayitem.php'</script>";
      }else{
      echo "<script language='javascript'> location='faillogin2.html'</script>";
	  }
?>